Wiki

Clone wiki

Rug.Osc / Message arguments as Rug.Osc understands them

Accepted .NET Argument Types

  • int (System.Int32)
  • long (System.Int64)
  • float (System.Single)
  • double (System.Double)
  • string (System.String)
  • symbol (Rug.Osc.OscSymbol)
  • True (System.Boolean)
  • False (System.Boolean)
  • RGBA (System.Drawing.Color)
  • Osc-Null (Rug.Osc.OscNull)
  • Osc-Timetag (Rug.Osc.OscTimeTag)
  • Osc-Midi (Rug.Osc.OscMidiMessage)
  • Impulse (Rug.Osc.OscImpulse)
  • Char (System.Byte)
  • Blob (System.Byte[])

Arrays

Any array of type System.Object is interpreted as a array and encoded as such.

#!c#

OscMessage message = new OscMessage("/foo", 1, 2, new object[] { 1, 2, 3 }); 

Note There maybe confusion when constructing a message when only 1 argument is supplied and that argument is an array. This is demonstrated below where the 2 message constructors below are equivalent.

#!c#

// These 2 constructors create exactly the same message
OscMessage message1 = new OscMessage("/foo", 1, 2, 3); 
OscMessage message2 = new OscMessage("/foo", new object[] { 1, 2, 3 }); // not an array an argument!

The correct way to create an array where there is only one argument and that argument is to be an array is listed below.

#!c#

OscMessage message = new OscMessage("/foo", new object[] { new object[] { 1, 2, 3 } }); 

Nested Arrays

Although the osc specification makes no mention of nested arrays it does not explicitly ban their use, to this end Rug.Osc supports the use of nested arrays.

Updated